<template>
  <div id="home">
    <transition name="down">
      <Search v-show="searchShow"></Search>
    </transition>
      <Up></Up>
    
    <div class="pages-top pages-scrolls">
      <Swiper :list="list" dots-position="center"></Swiper>
      <img class="index-services" src="/images/index-img/index-services.png">
      <div id="ppg">
        <router-link to=""><img src="/images/index-img/index-ppg1.png"></router-link>
        <router-link to=""><img src="/images/index-img/index-ppg2.jpg"></router-link>
      </div>
      <div class="hot">
        <h3>八大热销茶叶品类</h3>
        <p>总有你想不到的低价</p>
        <div >
          <router-link :to="'/'+h.classifyName+'/'+h.category" v-for="(h,i) in hotImgThen" :key="i"><img  class="hot-img" :src="h.img"></router-link>
        </div>
      </div>
    </div>
    <Tabbar></Tabbar>
  </div>
</template>

<script>
import Up from '../components/Up.vue';
import {Swiper} from 'vux';
import Tabbar from "../components/Tabbar.vue";
import Search from "../components/Search.vue";
import {mapState} from "vuex";
export default {
  components:{Up,Swiper,Tabbar,Search},
  data () {
    return {
      list:[{
        url:"",
        img:"/images/list/lunbo1.jpg"
      },{
        url:"",
        img:"/images/list/lunbo2.jpg"
      },{
        url:"",
        img:"/images/list/lunbo3.jpg"
      },{
        url:"",
        img:"/images/list/lunbo4.jpg"
      },{
        url:"",
        img:"/images/list/lunbo5.jpg"
      }],
    }
  },
  mounted:function(){
    this.$store.dispatch("requestHotImg");
  },
  computed:{
    ...mapState([
          "searchShow",
          "hotImgThen"
    ]),
  }
}
</script>

<style scoped>
  .pages-scrolls{
    overflow-y: scroll;
     height: calc(100vh - 20vw); 
  }
  #home{
    background-color: #F4F4F4;
    height: 100vh;
  }
  .index-services{
    width: 100%;
    background-color: white;
  }
  #ppg{
    display: flex;
    justify-content: space-around;
    background-color: white;
    margin: 2.8vw 0;
  }
  #ppg a>img{
    width: 47.04vw;
    margin: 1.68vw;

  }
  .hot{
    background-color: white;
    margin: 2.8vw 0;
    padding: 2.8vw;
    text-align: center;
    height: 1000px;
  }
  .down-leave,.down-enter-to{
    transform: translate(0,0);
  }
  .down-leave-active,.down-enter-active{
    transition: all 0.7s;
  }
  .down-leave-to,.down-enter{
    transform: translate(0,-100%);
  }
  .hot-img{
    width: 100%;
    margin-top: 1.4vw;
  }

  
</style>
